@import "../../styles/prism-theme.less";
@import "../../styles/prism-theme-dark.less";

:host {
  --context-max-height: 400px;

  td-select {
    --input-width: 120px;
  }
}

.TDesign-doc-usage {
  border-radius: 6px;
  border: 1px solid var(--component-border);
  overflow: auto;

  &__content {
    height: var(--context-max-height);
    background: var(--bg-color-demo);
    display: flex;
    justify-content: space-between;
  }
  
  &__render {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: space-between;
    max-width: calc(100% - 240px);

    &-slot {
      overflow: auto;
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      align-items: center;
      padding: 16px;
      gap: 8px;
      height: 100%;

      &::-webkit-scrollbar-corner {
        width: 0;
      }
    
      &::-webkit-scrollbar {
        width: 12px;
        height: 12px;
        background: transparent;
      }
    
      &::-webkit-scrollbar-thumb {
        border-radius: 6px;
        border: 4px solid transparent;
        background-clip: content-box;
        background-color: var(--bg-color-scroll);
      }
    }

    &-header {
      min-height: 48px;
      display: flex;
      box-sizing: border-box;
      box-shadow: var(--header-box-shadow);
      overflow: auto hidden;
      position: relative;

      .header-panel {
        padding: 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;

        
        &:hover {
          .panel-inner {
            background: var(--bg-color-container-hover);
          }
        }
        
        .panel-inner {
          padding: 8px;
          transition: all .2s linear;
          border-radius: 3px;

          &.active {
            color: var(--brand-main);
          }
        }
      }

      .active-line {
        height: 1px;
        position: absolute;
        left: 0;
        bottom: 0px;
        z-index: 10;
        background: var(--brand-main);
        transition: all .2s var(--anim-time-fn-easing);
      }
    }

    &-footer {
      height: 48px;
      display: flex;
      padding: 0 8px;
      flex-shrink: 0;
      justify-content: flex-end;
      gap: 8px;
      align-items: center;
      box-sizing: border-box;
  
      .action {
        height: 32px;
        width: 32px;
        padding: 8px;
        box-sizing: border-box;
        border-radius: var(--border-radius);
        cursor: pointer;
        user-select: none;
        transition: all .1s;
        display: inline-flex;
        color: var(--text-secondary);
  
        &:hover {
          color: var(--text-primary);
          background-color: var(--bg-color-demo-hover);
        }
  
        &.active {
          color: var(--text-primary);
          background-color: var(--bg-color-demo-select);
        }
      }
    }
  }

  &__config {
    width: 240px;
    box-sizing: border-box;
    flex-shrink: 0;
    border-left: 1px solid var(--component-stroke);

    &-title {
      display: flex;
      height: 48px;
      gap: 4px;
      align-items: center;
      padding: 12px 16px;
      box-sizing: border-box;
      border-bottom: 1px solid var(--component-stroke);
      
      span {
        font-size: 14px;
        line-height: 24px;
        color: var(--text-primary);
      }

      i {
        display: inline-flex;
      }
    }

    &-content {
      padding: 16px;
      overflow: hidden auto;
      display: flex;
      flex-direction: column;
      gap: 12px;
      max-height: calc(400px - 48px);
      box-sizing: border-box;

      &::-webkit-scrollbar-corner {
        width: 0;
      }
    
      &::-webkit-scrollbar {
        width: 12px;
        height: 12px;
        background: transparent;
      }
    
      &::-webkit-scrollbar-thumb {
        border-radius: 6px;
        border: 4px solid transparent;
        background-clip: content-box;
        background-color: var(--bg-color-scroll);
      }
    }

    &-divider {
      width: 100%;
      border-top: 1px solid var(--component-stroke);
    }

    &-list {
      display: flex;
      flex-direction: column;
      gap: 4px;
      list-style: none;
      margin: 0;
      padding: 0;

      .item {
        display: inline-flex;
        align-items: center;
        height: 32px;
        justify-content: space-between;

        .name {
          width: 90%;
          overflow: hidden;
          text-overflow: ellipsis;
          color: var(--text-secondary);
        }
      }
    }
  }

  &__code {
    border-radius: 0 0 6px 6px;
    overflow: hidden;
    max-height: 240px;

    pre {
      margin: 0;
      padding: 20px 24px;
      max-height: 240px;
      box-sizing: border-box;
      overflow: auto;
      background: var(--bg-color-code);
      color: var(--text-primary);

      &:hover {

        &::-webkit-scrollbar-thumb {
          background-color: var(--bg-color-scroll);
        }
      }
    
      &::-webkit-scrollbar {
        width: 12px;
        height: 12px;
        background: transparent;
      }

      &::-webkit-scrollbar-corner {
        width: 0;
      }
    
      &::-webkit-scrollbar-thumb {
        border-radius: 6px;
        border: 4px solid transparent;
        background-clip: content-box;
        background-color: transparent;
      }
    }
  }
}
